package com.edu.exam.entity.classmanagement.teaching;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import jakarta.persistence.*;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.time.LocalDateTime;

/**
 * 学生名单实体类
 * [所属模块] F-06 教学班管理模块
 * 对应数据库表：student_roster
 *
 * 根据简化后的F-06模块设计，管理学生与教学班的关联关系。
 * 支持学生添加、移除和状态管理。
 * 记录学生加入时间和备注信息。
 *
 * @author System
 * @version 3.0.0 (简化版)
 */
@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@Table(name = "student_roster")
public class StudentRoster {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Long id;

    @NotNull(message = "教学班ID不能为空")
    @Column(name = "teaching_class_id", nullable = false)
    private Long teachingClassId;

    @NotBlank(message = "学生ID不能为空")
    @Size(max = 50, message = "学生ID长度不能超过50个字符")
    @Column(name = "student_id", nullable = false, length = 50)
    private String studentId;

    @Column(name = "status", nullable = false, length = 20)
    @Builder.Default
    private String status = "ACTIVE";

    @Column(name = "join_time", nullable = false)
    @Builder.Default
    private LocalDateTime joinTime = LocalDateTime.now();

    @Size(max = 500, message = "备注信息长度不能超过500个字符")
    @Column(name = "remark", length = 500)
    private String remark;
}